<?php

namespace app\api\controller\merchant;

use app\common\controller\Api;
use app\common\model\Car as CarModel;
use app\api\model\CarCate;
use app\common\model\MerchantCar;
use app\common\model\Order;
use think\Model;

/**
 * 首页接口.
 */
class Car extends Api
{
    protected $noNeedLogin = [''];
    protected $noNeedRight = ['*'];

    /**
     * 车辆列表
     */
    public function carList()
    {
        $user = $this->auth->getUser();
        $requestData = $this->request->post();
        $model = new \app\api\model\Car();
        $data = $model->carList($requestData, $user);
        $this->getReturnData($data);
    }

    /**
     * 平台车辆列表
     */
    public function platformCar(){
        $user = $this->auth->getUser();
        $requestData = $this->request->post();
        $model = new \app\api\model\Car();
        $data = $model->platformCar($requestData, $user);
        $this->getReturnData($data);
    }

    /**
     * 添加车辆
     */
    public function saveCar(){
        $user = $this->auth->getUser();
        $requestData = $this->request->post();
        $model = new \app\api\model\Car();
        $data = $model->saveCar($requestData, $user);
        $this->getReturnData($data);
    }

    /**
     * 编辑车辆
     */
    public function editCar(){
        $user = $this->auth->getUser();
        $requestData = $this->request->post();
        $model = new \app\api\model\Car();
        $data = $model->editCar($requestData, $user);
        $this->getReturnData($data);
    }

    /**
     * 临时下架时间添加
     */
    public function temporaryTimeAdd(){
        $user = $this->auth->getUser();
        $requestData = $this->request->post();
        $model = new \app\api\model\Car();
        $data = $model->temporaryTimeAdd($requestData, $user);
        $this->getReturnData($data);
    }

    /**
     * 临时下架时间删除
     */
    public function temporaryTimeDel(){
        $user = $this->auth->getUser();
        $requestData = $this->request->post();
        $model = new \app\api\model\Car();
        $data = $model->temporaryTimeDel($requestData, $user);
        $this->getReturnData($data);
    }

    /**
     * 车辆上下架
     */
    public function editStatus(){
        $user = $this->auth->getUser();
        $requestData = $this->request->post();
        $model = new \app\api\model\Car();
        $data = $model->editStatus($requestData, $user);
        $this->getReturnData($data);
    }


    /**
     * 车辆删除
     */
    public function delCar(){
        $user = $this->auth->getUser();
        $requestData = $this->request->post();
        $model = new \app\api\model\Car();
        $data = $model->delCar($requestData, $user);
        $this->getReturnData($data);
    }

    /**
     * 价格日历
     */
    public function priceCalendar(){
        $user = $this->auth->getUser();
        $requestData = $this->request->post();
        $model = new \app\api\model\Car();
        $data = $model->priceCalendar($requestData, $user);
        $this->getReturnData($data);
    }

    /**
     * 车辆品牌和配置和车辆标签.
     */
    public function carCate(){
        $user = $this->auth->getUser();
        $model = new CarCate();
        $requestData = $model->carCate($user);
        $this->getReturnData($requestData);
    }

    /**
     * 车辆车型列表.
     */
    public function cateTypeList(){
        $user = $this->auth->getUser();
        $requestData = $this->request->post();
        $model = new CarCate();
        $requestData = $model->cateTypeList($requestData, $user);
        $this->getReturnData($requestData);
    }


}
